package com.xqls.biz.impl;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xqls.bean.WastegasSamplingBean;
import com.xqls.biz.AdministrationBiz;
import com.xqls.biz.WastegasSamplingBiz;
import com.xqls.dal.model.WastegasSampling;
import com.xqls.service.WastegasSamplingService;
import com.xqls.util.CommonResult;
@Service
public class WastegasSamplingBizImpl implements WastegasSamplingBiz{
	private static Logger logger = Logger.getLogger(WastegasSamplingBiz.class);
	@Autowired private AdministrationBiz administrationBiz; 
	@Autowired private WastegasSamplingService samplingService;
	@Override
	public CommonResult insertWastegasSampling(List<WastegasSamplingBean> SamplingBean) {
		CommonResult commonResult=new CommonResult();
		boolean success=false;
		try {
			for (WastegasSamplingBean wastegasSamplingBean : SamplingBean) {
				WastegasSampling sampling=samplingService.queryRecordByDeviceNo(wastegasSamplingBean.getDeviceNo());
				if(sampling==null){
					success=samplingService.insertWastegasSampling(wastegasSamplingBean);
				}else{
					success=samplingService.updateWastegasSampling(wastegasSamplingBean);
				}
			}
		} catch (Exception e) {
			logger.error("废气采样批量保存异常",e);
		}
		commonResult.setIsSuccess(success);
		return commonResult;
	}

	@Override
	public List<Map<String, Object>> selectByMap(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public WastegasSampling queryRecordByDeviceNo(String deviceNo) {
		// TODO Auto-generated method stub
		return null;
	}

}
